//package com.cf.data.serve.mq;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.cf.data.serve.entity.HkAlarmFail;
//import com.cf.data.serve.entity.HkMjAlarm;
//import com.cf.data.serve.entity.HkNvrAlarm;
//import com.cf.data.serve.mapper.HjjcDataMapper;
//import com.cf.data.serve.service.IHkMjAlarmService;
//import com.cf.data.serve.service.IHkNvrAlarmService;
//import com.cf.data.serve.utils.UUIDGenerator;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * @author cuixi
// * @description: 海康门禁事件消费者
// * @date 2024/7/31
// */
//
//@Component
//@RabbitListener(queues = "mj_queue")
//@Slf4j
//public class HkMjAlarmReceiver {
//
//    @Autowired
//    private IHkMjAlarmService hkMjAlarmService;
//
//
//
//
//    @Autowired
//    private HjjcDataMapper hjjcDataMapper;
//    @RabbitHandler
//    public void process(String message) {
//        //门禁门接收
//        HkMjAlarm o = JSONObject.parseObject(message, HkMjAlarm.class);
//        o.setId(UUIDGenerator.generate());
//        hkMjAlarmService.save(o);
//        String sblx = o.getSblx();
//        Map<String,Object> mm = new HashMap<>();
//        mm.put("sfzc",sblx);
//        mm.put("date",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//        mm.put("workerId",o.getUserId());
//        if("0".equals(sblx)){
//            //执行进场sql
//            hjjcDataMapper.updateWorkerJcForId(mm);
//        }else{
//            //执行出厂sql
//            hjjcDataMapper.updateWorkerCcForId(mm);
//        }
//        log.info("海康门禁事件消费者:接收["+o.getEventName()+"]消息：" + JSON.toJSONString(message));
//    }
//
//}
